import React,{useEffect,useState} from 'react'
import $axios from '../../utils/axios';
import SearchBar from '../../components/SearchBar'
import TabelRecord from '../../comments/TabelRecord'
import RecordDetail from './detail/RecordDetail';

export default function RecordContrant() {
  const [isFalse,setIsfalse] = useState(true)
  const [currentData,setCurrentData] = useState([])
  //接收子组件传来的值
  const sendData = (data:any)=>{
    // console.log(data)
    setIsfalse(data.isFalse)
    if(data.data){
      setCurrentData(data.data)
    }
  }
  return (
    <>
      { 
        isFalse && <div>
            <SearchBar></SearchBar>
            <TabelRecord sendData={sendData} isFalse={isFalse}></TabelRecord>
        </div>
      }
      {
        !isFalse && <RecordDetail sendData={sendData} currentData={currentData}></RecordDetail>
      }
    </>
  )
}
